<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Workflow_group extends Model
{
    //
	protected $table='workflow_group';
	protected $fillable=['workflow_id','group_id'];
	protected $hidden=[];

	public function getworkflow_id($id,$style){
		$data=$this->where(['group_id'=>$id])->with(['workflow'=>function($query) use($style){
			$query->where(['style'=>$style,'status'=>1]);
		}])->get()->toArray();
		$newArr=[];
		foreach($data as $kk=>$vv){
			if($vv['workflow']){
				 return $newArr=$vv['workflow'];
			}
		}
		return $newArr;
	}

	public function workflow(){
		return $this->belongsTo('App\Model\workflow','workflow_id');
	}
}
